﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AIProject.Pylos;

namespace AIProject.Search
{
    class Node
    {
        private State state;
        private int cost;

        public State State
        {
            get
            {
                return this.state;
            }
            set
            {
                this.state = value;
            }
        }

        public int Cost
        {
            get
            {
                return this.cost;
            }
            set
            {
                this.cost = value;
            }
        }

        public Node(State state)
            : this(state, 0)
        {
        }

        public Node(State state, int cost)
        {
            this.state = state;
            this.cost = cost;

        }

        public Object clone()
        {
            return new Node((State)state.clone(), cost);
        }

        public void update(AIProject.Pylos.Action action)
        {
            state.update(action);
            cost = cost + action.Cost;
        }
    }
}
